<template>
	<div class="demo">
		<label><input type="radio" v-model="current" :value="CompA"/>A</label>
		<label><input type="radio" v-model="current" :value="CompB"/>B</label>
		<KeepAlive>
			<component :is="current"></component>
		</KeepAlive>
	</div>
</template>
  
<script setup>
	import { shallowRef } from "vue"
	import CompA from '@/components/CompA.vue'	
	import CompB from '@/components/CompB.vue'
	
	const current = shallowRef(CompA)
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
